var placeHolderStyle = {
	normal: {
		color: 'rgba(44,59,70,1)', // 未完成的圆环的颜色
		label: {
			show: false
		},
		labelLine: {
			show: false
		}
	},
	emphasis: {
		color: 'rgba(44,59,70,1)' // 未完成的圆环的颜色
	}
};




//迟到图表数据
var beLateOption = {
	tooltip: {
		trigger: 'item',
		//      formatter: "{a} <br/>{b} : {d}%",
		formatter: function(param) {
			//      	console.log(param);
			var sHtml = '<div><b>' + param.name + '</b></div>' +
				'<div><b>迟到人数</b>:<span>' + param.value + '</span></div>' +
				'<div><b>占全年级迟到人数比例</b>:<span>' + param.percent + '%</span></div>';
			return sHtml;
		}
	},
	legend: {
		//      orient: 'vertical',
		left: 'left',
		top: '0%',
		data: ['初一年级老师', '初二年纪老师', '初三年纪老师', '高一年纪老师', '高二年纪老师', '高三年纪老师']
	},
	series: [{
		name: '类目',
		type: 'pie',
		//		            type: 'line',
		radius: '55%',
		center: ['50%', '50%'],
		data: [{
				value: 19,
				name: '初一年级老师',
				itemStyle: {
					normal: {
						color: '#EA9294'
					}
				}
			},
			{
				value: 12,
				name: '初二年纪老师',
				itemStyle: {
					normal: {
						color: '#949494'
					}
				}
			},
			{
				value: 2,
				name: '初三年纪老师',
				itemStyle: {
					normal: {
						color: '#A4D2D5'
					}
				}
			},
			{
				value: 8,
				name: '高一年纪老师',
				itemStyle: {
					normal: {
						color: '#F1C0B1'
					}
				}
			},
			{
				value: 6,
				name: '高二年纪老师',
				itemStyle: {
					normal: {
						color: '#BAD7CB'
					}
				}
			},
			{
				value: 1,
				name: '高三年纪老师',
				itemStyle: {
					normal: {
						color: '#8B99A1'
					}
				}
			},
		],
		itemStyle: {
			emphasis: {
				shadowBlur: 10,
				shadowOffsetX: 0,
				shadowColor: 'rgba(0, 0, 0, 0.5)'
			}
		}
	}]
};

//旷工图表数据
var absenteeismOption = {
	tooltip: {
		trigger: 'item',
		//      formatter: "{a} <br/>{b} : {d}%",
		formatter: function(param) {
			//      	console.log(param);
			var sHtml = '<div><b>' + param.name + '</b></div>' +
				'<div><b>旷工人数</b>:<span>' + param.value + '</span></div>' +
				'<div><b>占全年级旷工人数比例</b>:<span>' + param.percent + '%</span></div>';
			return sHtml;
		}
	},
	legend: {
		//      orient: 'vertical',
		left: 'left',
		top: '0%',
		data: ['初一年级老师', '初二年纪老师', '初三年纪老师', '高一年纪老师', '高二年纪老师', '高三年纪老师']
	},
	series: [{
		name: '类目',
		type: 'pie',
		//		            type: 'line',
		radius: '55%',
		center: ['50%', '50%'],
		data: [{
				value: 1,
				name: '初一年级老师',
				itemStyle: {
					normal: {
						color: '#EA9294'
					}
				}
			},
			{
				value: 2,
				name: '初二年纪老师',
				itemStyle: {
					normal: {
						color: '#949494'
					}
				}
			},
			{
				value: 3,
				name: '初三年纪老师',
				itemStyle: {
					normal: {
						color: '#A4D2D5'
					}
				}
			},
			{
				value: 8,
				name: '高一年纪老师',
				itemStyle: {
					normal: {
						color: '#F1C0B1'
					}
				}
			},
			{
				value: 6,
				name: '高二年纪老师',
				itemStyle: {
					normal: {
						color: '#BAD7CB'
					}
				}
			},
			{
				value: 1,
				name: '高三年纪老师',
				itemStyle: {
					normal: {
						color: '#8B99A1'
					}
				}
			},
		],
		itemStyle: {
			emphasis: {
				shadowBlur: 10,
				shadowOffsetX: 0,
				shadowColor: 'rgba(0, 0, 0, 0.5)'
			}
		}
	}]
};

//早退图表数据
var leaveEarlyOption = {
	backgroundColor: '#00265f',
	tooltip: {
		trigger: 'item',
		//      formatter: "{a} <br/>{b} : {d}%",
		formatter: function(param) {
			//      	console.log(param);
			var sHtml = '<div><b>' + param.name + '老师</b></div>' +
				'<div><b>早退人数</b>:<span>' + param.value + '</span></div>' +
				'<div><b>占全年级早退人数比例</b>:<span>' + (param.value / param.data.total * 100).toFixed(2) + '%</span></div>';
			return sHtml;
		}
	},
	grid: {
		left: '3%',
		right: '4%',
		bottom: '3%',
		containLabel: true
	},
	xAxis: [{
		type: 'category',
		data: ['初一', '初二', '初三', '高一', '高二', '高三'],
		axisLine: {
			show: true,
			lineStyle: {
				color: "#063374",
				width: 1,
				type: "solid"
			}
		},
		axisTick: {
			show: false
		},
		axisLabel: {
			show: true,
			textStyle: {
				color: "#00c7ff",
			}
		},
	}],
	yAxis: [{
		type: 'value',
		axisLabel: {
			//          formatter: '{value} %',
			formatter: function(param) {
				//          	console.log(param);
				return param + "人";
			}
		},
		axisLine: {
			show: false,
			lineStyle: {
				color: "#00c7ff",
				width: 1,
				type: "solid"
			},
		},
		axisTick: {
			show: false
		},
		splitLine: {
			lineStyle: {
				color: "#063374",
			}
		}
	}],

	series: [{
		type: 'bar',
		//      data: [2, 5, 8, 10, 3, 6],
		data: [{
				value: 2,
				total: 34
			},
			{
				value: 5,
				total: 34
			},
			{
				value: 8,
				total: 34
			},
			{
				value: 10,
				total: 34
			},
			{
				value: 3,
				total: 34
			},
			{
				value: 6,
				total: 34
			}
		],
		//barWidth: 50, //柱子宽度
		//barGap: 1, //柱子之间间距
		itemStyle: {
			normal: {
				color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					offset: 0,
					color: '#00fcae'
				}, {
					offset: 1,
					color: '#006388'
				}]),
				opacity: 1,
			}
		}
	}]
};

//在校图表数据
var onSchoolOption = {
	backgroundColor: '#00265f',
	tooltip: {
		trigger: 'item',
		//      formatter: "{a} <br/>{b} : {d}%",
		formatter: function(param) {
			//      	console.log(param);
			var sHtml = '<div><b>' + param.name + '老师</b></div>' +
				'<div><b>在校人数</b>:<span>' + param.value + '</span></div>' +
				'<div><b>占全年级在校人数比例</b>:<span>' + (param.value / param.data.total * 100).toFixed(2) + '%</span></div>';
			return sHtml;
		}
	},
	grid: {
		left: '3%',
		right: '4%',
		bottom: '3%',
		containLabel: true
	},
	xAxis: [{
		type: 'category',
		data: ['初一', '初二', '初三', '高一', '高二', '高三'],
		axisLine: {
			show: true,
			lineStyle: {
				color: "#063374",
				width: 1,
				type: "solid"
			}
		},
		axisTick: {
			show: false
		},
		axisLabel: {
			show: true,
			textStyle: {
				color: "#00c7ff",
			}
		},
	}],
	yAxis: [{
		type: 'value',
		axisLabel: {
			//          formatter: '{value} %',
			formatter: function(param) {
				return param + "人";
			}
		},
		axisLine: {
			show: false,
			lineStyle: {
				color: "#00c7ff",
				width: 1,
				type: "solid"
			},
		},
		axisTick: {
			show: false
		},
		splitLine: {
			lineStyle: {
				color: "#063374",
			}
		}
	}],

	series: [{
		type: 'bar',
		//      data: [2, 5, 8, 10, 3, 6],
		data: [{
				value: 18,
				total: 100
			},
			{
				value: 25,
				total: 100
			},
			{
				value: 12,
				total: 100
			},
			{
				value: 5,
				total: 100
			},
			{
				value: 20,
				total: 100
			},
			{
				value: 20,
				total: 100
			}
		],
		//barWidth: 50, //柱子宽度
		//barGap: 1, //柱子之间间距
		itemStyle: {
			normal: {
				color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					offset: 0,
					color: '#00fcae'
				}, {
					offset: 1,
					color: '#006388'
				}]),
				opacity: 1,
			}
		}
	}]
};

//全部信息查询图表数据
var serachData = {
	tooltip: {
		trigger: 'item',
		formatter: function(param) {
			var sHtml = '<div><b>' + param.name + '</b></div>' +
				'<div><b>人数</b>:<span>' + param.value + '</span></div>' +
				'<div><b>占全部人数比例</b>:<span>' + param.percent + '%</span></div>';
			return sHtml;
		}
	},
	legend: {
		x: 'center',
		y: 'bottom',
		data: ['迟到的老师', '早退的老师', '旷工的老师', '正常上班的老师']
	},
	series: [
		{
			
			name: '类目',
			type: 'pie',
			radius: '55%',
			data: [{
					value: 6,
					name: '迟到的老师',
					itemStyle: {
						normal: {
							color: '#EA9294'
						}
					}
				},
				{
					value: 4,
					name: '早退的老师',
					itemStyle: {
						normal: {
							color: '#949494'
						}
					}
				},
				{
					value: 2,
					name: '旷工的老师',
					itemStyle: {
						normal: {
							color: '#A4D2D5'
						}
					}
				},
				{
					value: 88,
					name: '正常上班的老师',
					itemStyle: {
						normal: {
							color: '#F1C0B1'
						}
					}
				},
			],
			itemStyle: {
				emphasis: {
					shadowBlur: 10,
					shadowOffsetX: 0,
					shadowColor: 'rgba(0, 0, 0, 0.5)'
				}
			}
		},
	]
};

//分类信息查询数组
var aSearch = [
	{
		name:"迟到",
		value:[
			10,//迟到人数
			90,//未迟到人数
			"10%"//迟到人数占比
		],
		center:['25%', '25%']
	},
	{
		name:"早退",
		value:[
			15,//早退人数
			85,//未早退人数
			"15%"//早退人数占比
		],
		center:['75%', '25%']
	},
	{
		name:"旷工",
		value:[
			8,//旷工人数
			92,//未旷工人数
			"8%"//旷工人数占比
		],
		center:['25%', '75%']
	},
	{
		name:"正常考勤",
		value:[
			67,//正常考勤人数
			33,//异常考勤人数
			"67%"//正常考勤人数占比
		],
		center:['75%', '75%']
	},
];
//分类信息查询数据
var serachData2 = {
	tooltip: {
		show: true,
	},
	toolbox: {
		show: true,
	},
	series:[	
	],
};
backData(aSearch);
//生成图表环形数据
function backData(arr){
	$.each(arr, function(i,v) {
		serachData2.series.push(
			{				
				type: 'pie',
				clockWise: true,//顺时针方向
				radius: [80, 85],
				hoverAnimation: true,
				center: v.center,
				data: [
					{
						value: v.value,
						name: v.name + '人数',
						label: {
							normal: {
								formatter: function(p) {
									return v.name + '人数占比：'+ v.value[2]
								},
								position: 'center',
								show: true,
								textStyle: {
									fontSize: '15',
									fontWeight: 'normal',
									color: '#3dd4de'
								}
							}							
						},
						tooltip: {
							show: true,
							formatter: function(p) {
								var str = p.name +":"+ p.data.value[0] + "<br/>"+
										  "无"+ p.name +":"+ p.data.value[1];
								return str;
							},
						},
						itemStyle: {
							normal: {
								color: '#3dd4de',
								shadowColor: '#3dd4de',
								shadowBlur: 10
							}
						}
					},
					{
						value: v.value[1],
						name: '无'+v.name + '人数',
						itemStyle: placeHolderStyle,
						tooltip: {
							show: false,
						},
					}
				]
			}
		);
	});
}
